Skip to content

Streamline source creation#6849

Draft
TomasLongo wants to merge 2 commits into
opensearch-project:mainfrom
sternadsoftware:streamline-otel-sources
Draft

Streamline source creation#6849
TomasLongo wants to merge 2 commits into
opensearch-project:mainfrom
sternadsoftware:streamline-otel-sources

Conversation

@TomasLongo
Copy link
Copy Markdown
Contributor

Description

[Describe what this change achieves]

Issues Resolved

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Tomas Longo <tlongo@sternad.de>
@github-actions
Copy link
Copy Markdown

⚠️ License Header Violations Found

The following newly added files are missing required license headers:

  • data-prepper-plugins/otel-metrics-source/src/main/java/org/opensearch/dataprepper/plugins/source/otelmetrics/grpc/GrpcServiceConfigurator.java
  • data-prepper-plugins/otel-trace-source/src/main/java/org/opensearch/dataprepper/plugins/source/oteltrace/grpc/GrpcServiceConfigurator.java
  • data-prepper-plugins/otel-trace-source/src/main/java/org/opensearch/dataprepper/plugins/source/oteltrace/http/HttpServiceConfigurator.java

Please add the appropriate license header to each file and push your changes.

See the license header requirements: https://github.com/opensearch-project/data-prepper/blob/main/CONTRIBUTING.md#license-headers


private static final Logger LOG = LoggerFactory.getLogger(GrpcServiceConfigurator.class);
private static final String PIPELINE_NAME_PLACEHOLDER = "${pipelineName}";
private static final String REGEX_HEALTH = "regex:^/(?!health$).*$";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REGEX_HEALTH is duplicated across all three OTel sources (trace, metrics, logs). Extract to a shared constant in a common location.

private static final String PIPELINE_NAME_PLACEHOLDER = "${pipelineName}";
private static final String REGEX_HEALTH = "regex:^/(?!health$).*$";
private static final RetryInfoConfig DEFAULT_RETRY_INFO =
new RetryInfoConfig(Duration.ofMillis(100), Duration.ofMillis(2000));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEFAULT_RETRY_INFO is duplicated identically in both GrpcServiceConfigurator and HttpServiceConfigurator. Extract to shared constant or config default.

*/

package org.opensearch.dataprepper.plugins.source.otellogs.grpc;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GrpcServiceConfigurator.java / HttpServiceConfigurator.java. These are nearly identical across otel-trace, otel-metrics, and otel-logs (3 copies each). This is the same code triplicated. Should live in a shared otel-source-common module or otel-proto-common.

* compatible open source license.
*
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GrpcServiceConfigurator.java / HttpServiceConfigurator.java. These are nearly identical across otel-trace, otel-metrics, and otel-logs (3 copies each). This is the same code triplicated. Should live in a shared otel-source-common module or otel-proto-common.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They rely on the different config classes though. They need to be taken into consideration.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree the config classes differ, but they all expose the same methods (getPath, hasHealthCheck, getCompression, getAuthentication, getRetryInfo). An interface like OTelSourceConfig defining those common methods would let a single generic configurator work across all three sources without losing type safety.

Copy link
Copy Markdown
Collaborator

@KarstenSchnitter KarstenSchnitter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for providing this PR.

It seems, that all sources require GrpcServiceConfiguration and HttpServiceConfiguration classes, that do not contain any differentiated behaviour. They could be copies of each other, but they still differ in small ways. @TomasLongo are these differences intentional or is it possible to align them completely? If they can be aligned, is there a place to reuse the code and avoid duplicates? I understand, that they have a dependency on the different Config classes.

sb.service(builtGrpcService, DecodingService.newDecorator());
}

authenticationProvider.getHttpAuthenticationService().ifPresent(sb::decorator);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below

* compatible open source license.
*
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They rely on the different config classes though. They need to be taken into consideration.

Copy link
Copy Markdown
Collaborator

@KarstenSchnitter KarstenSchnitter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more license header, please check the automated test results.

Signed-off-by: Tomas Longo <tlongo@sternad.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants